<?php
namespace App\Models\Traits;

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/8 0008
 * Time: 8:25
 */

trait RecordLastLoginHelper {

    public function recordLoginTime() {
        $key = 'last_login_'.Carbon::now()->toDateString();
        $value = Carbon::now()->toDateTimeString();
        $hash_key = 'user_'.Auth::id();
        Redis::hSet($key,$hash_key,$value);
    }
}